<include file="default/public/header_mini" />
<div class="reg-notice"> <i class="reg-xing">*</i>注：找回密码请先获取验证码，验证手机，再更改密码，谢谢！ </div>
<div class="reg-form-box">
<div id="errmsg"></div>
  <div class="am-form am-form-horizontal">
    <div class="am-form-group">
      <label for="doc-ipt-3" class="am-u-sm-3 am-form-label">用户名：</label>
      <div class="am-u-sm-9">
        <input type="text" id="userPhone" placeholder="请输入您的手机号">
      </div>
    </div>
    <div class="am-form-group">
      <label for="doc-ipt-pwd-2" class="am-u-sm-3 am-form-label">验证码：</label>
      <div class="am-u-sm-4">
        <input type="text" id="mobileCode" placeholder="请输入验证码">
      </div>
      <div class="am-u-sm-5">
        <input type="button" class="am-btn am-btn-warning" id="getMobileCode" value="获取验证码" onclick="getPwdPhoneVerifyCode(this)" />
      </div>
    </div>
    <div class="am-form-group">
      <div class="am-u-sm-9 am-u-sm-offset-3">
        <button type="submit" class="am-btn am-btn-danger" onClick="setCode()">下一步</button>
      </div>
    </div>
  </div>
</div>
<script src="__ROOT__/Apps/Wap/View/default/assets/js/jquery.min.js"></script> 
<script src="__ROOT__/Apps/Wap/View/default/assets/js/amazeui.min.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
var countdown=60; 
function getPwdPhoneVerifyCode(obj) {
	var params = {};
   	params.userPhone = $.trim($('#userPhone').val());
	$.post("{:U('Wap/Users/getPwdPhoneVerifyCode')}",params,function(data,textStatus){
	   var json = MXC.toJson(data);
		if(json.code == 1) {
			alert(json.info);
			settime(obj);
		} else {
			alert(json.info);
		}
   });
}
function settime(obj) {
	if (countdown == 0) { 
		obj.removeAttribute("disabled");    
		obj.value="获取验证码"; 
		countdown = 60; 
		return;
	} else { 
		obj.setAttribute("disabled", true); 
		obj.value="重新发送(" + countdown + ")"; 
		countdown--; 
	} 
	setTimeout(function() { 
			settime(obj) 
		} ,1000) 
}
function setCode(){
   var params = {};
   params.userPhone = $.trim($('#userPhone').val());
   params.mobileCode = $.trim($('#mobileCode').val());
   if(params.userPhone==''){
	   $("#errmsg").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请输入手机号码!");
	   $('#userPhone').focus();
	   return;
   }
   if(params.mobileCode==''){
	   $("#errmsg").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请输入验证码!");
	   $('#mobileCode').focus();
	   return;
   }
   $.post("{:U('Wap/Users/setCode')}",params,function(data,textStatus){
	   var json = MXC.toJson(data);
		if(json.code=='1'){
			location.href= "{:U('Wap/Users/repassword')}";
		}else{
			$("#errmsg").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + json.info);
		}
   });
}
</script>
</body>
</html>
